Skip to content

Add license key requirements - #293

Merged
budnix merged 7 commits into
developfrom
feature/issue-222
Apr 15, 2020
Merged

budnix merged 7 commits into
developfrom
feature/issue-222

Conversation

@budnix

@budnix budnix commented Apr 10, 2020 •

Copy link
Copy Markdown
Member

Context

Adds license key validity to the HF. Replace environment variables to
literal values declared in the hf.config.js file. Now, for all modules
(commons, es, jest - TS) the global values are available.

Moves testConfig.ts file to global config which Jest provides.

How has this been tested?

The license key to test:

  • agpl-v3 (valid);
  • non-commercial-and-evaluation (valid);
  • d95da-4218c-26e94-18316-4e52e - It will expire at: 12/01/2020 (valid);
  • 6a76d-572a4-a2a54-3711f-3a047 - It will expire at: 11/01/2020 (valid - the algorithm postpones the message printing by 1 day max);
  • 80584-cc272-2e7c4-06f16-4db00 - It will expire at: 10/01/2020 (expired);
  • 8c6d8-91044-e3cc4-5441a-3ac0a - It will expire at: 10/01/2019 (expired);

Currently, develop branch has set the release date to 12/01/2020.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature or improvement (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Additional language file or change to the existing one (translations)

Related issue(s):

  1. Add LicenseKey verification #222

Checklist:

  • My code follows the code style of this project,
  • My change requires a change to the documentation,
  • I described the modification in the CHANGELOG.md file.

budnix added 2 commits April 10, 2020 16:13
Adds license key validity to the HF. Replace environment variables to
literal values declared in the hf.config.js file. Now, for all modules
the global values are available.

Moves testConfig.ts file to global config which Jest provides.
@budnix budnix self-assigned this Apr 14, 2020
@budnix
budnix marked this pull request as ready for review April 14, 2020 09:00
@budnix
budnix requested a review from wojciechczerniak April 14, 2020 09:01
@budnix budnix assigned wojciechczerniak and unassigned budnix Apr 14, 2020

@wojciechczerniak wojciechczerniak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! 🏆

Is there something we can do about the date format displayed to the end-user? I think we have just the date part displayed in HoT?

"The license key for HyperFormula expired on 2019-01-11T00:00:00.000Z, and is not valid for the installed version."

Comment thread src/BuildEngineFactory.ts Outdated

export class BuildEngineFactory {
private static buildEngine(config: Config, sheets: Sheets = {}, stats: Statistics = config.useStats ? new Statistics() : new EmptyStatistics()): EngineState {
checkLicenseKeyValidity(config.licenseKey)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need the info if the license is invalid to use it in Interpreter so we can display #LIC! error as a result of formula evaluation or any other way to indicate wrong license string in case the HF is used server-side and the console.log may not be available.

Suggested change
checkLicenseKeyValidity(config.licenseKey)
config.licenseValid = checkLicenseKeyValidity(config.licenseKey)

The field should be private and marked as @internal for internal use only.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot about that. Good catch! I'll do that.

budnix added 3 commits April 15, 2020 11:09
Adds "licenseKeyValidityState" property to the Config class. The
property holds a state about checking the license key validity. The
property is protected from modification by defining its getter only.

Additionally, the commit adds TS definition for the licenseKey checker
helper and the result of the expired message is formatted better.
@budnix budnix assigned wojciechczerniak and unassigned budnix Apr 15, 2020
@budnix

budnix commented Apr 15, 2020 •

Copy link
Copy Markdown
Member Author

@wojciechczerniak I fixed all mentioned issues.

  • The date in the "expired" message is formated using MMMM DD, YYYY format;
  • The licenseKeyValidityState property holds the result of the license key checking. It is transformed into a getter to be non-writeable. It is accessible in the same way as the other Config props.

@wojciechczerniak wojciechczerniak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The names licenseKey.ts and _licenseKey.ts are confusing a little bit. licenseKeyHelper.ts and licenseKeyValidator.ts / licenseKeyChecker.ts / licenseKeySchema.ts? Not that important though

LG(reat)TM 👍

@budnix
budnix merged commit ee9c45a into develop Apr 15, 2020
@budnix
budnix deleted the feature/issue-222 branch April 15, 2020 13:15
@budnix

budnix commented Apr 15, 2020

Copy link
Copy Markdown
Member Author

The names licenseKey.ts and _licenseKey.ts are confusing a little bit. licenseKeyHelper.ts and licenseKeyValidator.ts / licenseKeyChecker.ts / licenseKeySchema.ts? Not that important though

LG(reat)TM 👍

After merging the PR I thought that it can be a good idea. I've prepared a separate PR #299 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants